<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<LINK rel="stylesheet" type="text/css" href=<c:url value="/design.css"/>>
<link rel="icon" type="image/png"
	href="<c:url value="/pics/design/favicon.ico"/>" />
<title>Mon Compte - Nerd Shop</title>
</head>
<jsp:include page="/header.jsp" />
<body>
	<div id="infos">
		<p id="inscription_error">
			<c:out value="${affichage.error}" />
		</p>
		<form action=<c:url value="/monCompte"/> method="post">
			<table>
				<tr>
					<td><label for="nom">Nom : </label></td>
					<td><input type="text" name="nom"
						value="<c:out value="${affichage.user.nom}"/>" /></td>
				</tr>
				<tr>
					<td><label for="prenom">Prénom : </label></td>
					<td><input type="text" name="prenom"
						value="<c:out value="${affichage.user.prenom}"/>" /></td>
				</tr>
				<tr>
					<td><label for="date">Date de naissance (jj/mm/yyyy) :
					</label></td>
					<td><input type="text" name="date"
						value="<c:out value="${affichage.user.birth.date}"/>/<c:out value="${affichage.user.birth.month+1}"/>/<c:out value="${affichage.user.birth.year+1900}"/>" /></td>
				</tr>
				<tr>
					<td><label for="sexe">Sexe : </label></td>
					<td><input type="radio" name="sexe" value="Femme"
						<c:if test="${!affichage.user.sexe}"> checked</c:if>>
						Femme <input type="radio" name="sexe" value="Homme"
						<c:if test="${affichage.user.sexe}"> checked</c:if>> Homme
					</td>
				</tr>
				<tr>
					<td><label for="mail">Adresse mail : </label></td>
					<td><input type="text" name="mail"
						value="<c:out value="${affichage.user.mail}"/>" /></td>
				</tr>
				<tr>
					<td><label for="mailconfirm">Confirmation adresse mail
							: </label></td>
					<td><input type="text" name="mailconfirm"
						value="<c:out value="${affichage.user.mail}"/>" /></td>
				</tr>
				<tr>
					<td><label for="password">Mot de passe (8 caractères
							minimum) : </label></td>
					<td><input type="password" name="password" /></td>
				</tr>
				<tr>
					<td><label for="passwordconfirm">Confirmation mot de
							passe : </label></td>
					<td><input type="password" name="passwordconfirm" /></td>
				</tr>
				<tr>
					<td><label for="telephone">Telephone (au format
							0123456789) : </label></td>
					<td><input type="text" name="telephone"
						value="<c:out value="${affichage.user.telephone}"/>" /></td>
				</tr>
				<tr>
					<td><label for="numero">Numero : </label></td>
					<td><input type="text" name="numero"
						value="<c:out value="${affichage.user.adresse.numero}"/>" /></td>
				</tr>
				<tr>
					<td><label for="complementnumero">Complement numero :
					</label></td>
					<td><input type="text" name="complementnumero"
						value="<c:out value="${affichage.user.adresse.complement_numero}"/>" />
					</td>
				</tr>
				<tr>
					<td><label for="rue">Rue : </label></td>
					<td><input type="text" name="rue"
						value="<c:out value="${affichage.user.adresse.rue}"/>" /></td>
				</tr>
				<tr>
					<td><label for="codepostal">Code postal : </label></td>
					<td><input type="text" name="codepostal"
						value="<c:out value="${affichage.user.adresse.code_postal}"/>" /></td>
				</tr>
				<tr>
					<td><label for="ville">Ville : </label></td>
					<td><input type="text" name="ville"
						value="<c:out value="${affichage.user.adresse.ville}"/>" /></td>
				</tr>
				<tr>
					<td><label for="departement">Departement : </label></td>
					<td><input type="text" name="departement"
						value="<c:out value="${affichage.user.adresse.departement}"/>" /></td>
				</tr>
				<tr>
					<td><label for="region">Region : </label></td>
					<td><input type="text" name="region"
						value="<c:out value="${affichage.user.adresse.region}"/>" /></td>
				</tr>
			</table>
			<input type="submit" value="enregistrer" />
		</form>
	</div>
	<div id="historique_commandes">
		<h2>Historique de vos commandes</h2>
		<c:if test="${empty affichage.user.commandes}">vous n'avez pas encore passé de commandes</c:if>
		<c:if test="${!empty affichage.user.commandes}">
			<table>
				<tr>
					<th>date de la commande</th>
					<th>REF commande</th>
					<th>prix total</th>
					<th>detail commande</th>
				</tr>
				<c:forEach var="commande" items="${affichage.user.commandes}">
					<tr>
						<td><c:out value="${commande.date.date}" />/<c:out
								value="${commande.date.month+1}" />/<c:out
								value="${commande.date.year+1900}" /></td>
						<td><c:out value="${commande.id}" /></td>
						<td><c:out value="${commande.total}" /></td>
						<td><a
							href="<c:url value="/detailCommande"/>?id=<c:out value="${commande.id}"/>">voir
								les détails</a></td>
					</tr>
				</c:forEach>
			</table>
		</c:if>
	</div>
</body>
<jsp:include page="/footer.jsp" />
</html>